set(GENERATE_LIB FALSE)
file(GLOB FSPLIT_FILES *.f )
#message(STATUS ${FSPLIT_FILES})
file(WRITE ${FSPLIT_OUTFILE} "" )
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${LIB})
	set(GENERATE_LIB TRUE)
endif()
file(READ ${SOURCES_FILE} SOURCES)
#check if sources newere then lib
foreach(SOURCE_FILE ${SOURCES})
	if(${SOURCE_FILE} IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${LIB})
		set(GENERATE_LIB TRUE)
		message(STATUS "${SOURCE_FILE} is newer than ${CMAKE_CURRENT_BINARY_DIR}/${LIB}")
	endif()
endforeach()

if(GENERATE_LIB)
	
	foreach(FFILE ${FSPLIT_FILES})
		file(APPEND ${FSPLIT_OUTFILE} "${FFILE}\n")
	endforeach(FFILE ${FSPLIT_FILES})
	message("Collected Files: ${FSPLIT_OUTFILE}")
endif()
